package UIUtils {
	public class union {

		public static function createAs(obj: Object): Object {
			return (obj is Array)?(new Array()):(
				(obj.hasOwnProperty('clone'))?obj.clone():((obj is Object)?(new Object()):null)
			)
		}  
		
		public static function apply(obj1: Object, obj2: Object, isNewObject: Boolean = true): Object {
			var newObj: Object = isNewObject?(createAs(obj1)):obj1;
			var i: String;
			for (i in obj1) newObj[i] = obj1[i];
			for (i in obj2) newObj[i] = obj2[i];
			return newObj;
		}
	}
}